var gradualFader = {};

gradualFader.baseopacity = .4, gradualFader.increment = .2, document.write('<style type="text/css">\n'), 
document.write(".gradualfader{filter:progid:DXImageTransform.Microsoft.alpha(opacity=" + 100 * gradualFader.baseopacity + "); -moz-opacity:" + gradualFader.baseopacity + "; opacity:" + gradualFader.baseopacity + ";}\n"), 
document.write("</style>"), gradualFader.setopacity = function(a, b) {
    var c = a;
    c && c.filters && c.filters[0] ? "number" == typeof c.filters[0].opacity ? c.filters[0].opacity = 100 * b : c.style.filter = "alpha(opacity=" + 100 * b + ")" : c && "undefined" != typeof c.style.MozOpacity ? c.style.MozOpacity = b : c && "undefined" != typeof c.style.opacity && (c.style.opacity = b), 
    c.currentopacity = b;
}, gradualFader.fadeupdown = function(a, b) {
    var c = a, d = "fadeup" == b ? this.increment : -this.increment;
    c && ("fadeup" == b && c.currentopacity < 1 || "fadedown" == b && c.currentopacity > this.baseopacity) && (this.setopacity(a, c.currentopacity + d), 
    window["opacityfader" + a._fadeorder] = setTimeout(function() {
        gradualFader.fadeupdown(a, b);
    }, 50));
}, gradualFader.clearTimer = function(a) {
    "undefined" != typeof window["opacityfader" + a._fadeorder] && clearTimeout(window["opacityfader" + a._fadeorder]);
}, gradualFader.isContained = function(a, b) {
    var c;
    for (b = window.event || b, c = b.relatedTarget || ("mouseover" == b.type ? b.fromElement : b.toElement); c && c != a; ) try {
        c = c.parentNode;
    } catch (b) {
        c = a;
    }
    return c == a ? !0 : !1;
}, gradualFader.fadeinterface = function(a, b, c) {
    this.isContained(a, b) || (gradualFader.clearTimer(a), gradualFader.fadeupdown(a, c));
}, gradualFader.collectElementbyClass = function(a) {
    var e, b = new RegExp("(^|\\s+)" + a + "($|\\s+)", "i"), c = [], d = document.all ? document.all : document.getElementsByTagName("*");
    for (e = 0; e < d.length; e++) "string" == typeof d[e].className && -1 != d[e].className.search(b) && (c[c.length] = d[e]);
    return c;
}, gradualFader.init = function() {
    var b, a = this.collectElementbyClass("imgFade");
    for (b = 0; b < a.length; b++) a[b]._fadeorder = b, this.setopacity(a[b], this.baseopacity), 
    a[b].onmouseover = function(a) {
        gradualFader.fadeinterface(this, a, "fadeup");
    }, a[b].onmouseout = function(a) {
        gradualFader.fadeinterface(this, a, "fadedown");
    };
}, jQuery.fn.extend({
    imgFadeRender: function() {
        gradualFader.init();
    }
});